//
//  ViewController.m
//  LineShowDome
//
//  Created by lirilu on 15/6/24.
//  Copyright (c) 2015年 glirlu@gmail.com. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()<Alu_LineShowViewDeletage,Alu_LineShowViewDataSourceDelegate>
@property(retain,nonatomic) NSArray *titleArray;
@property(assign,nonatomic) NSInteger curIndex;
@property(retain,nonatomic) NSArray *valueArray;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    _titleArray = [[NSArray alloc]initWithObjects:
                   @"周日",@"周一",@"周二",@"周三",@"周四",@"周五",@"周六", nil];
    _valueArray = [[NSArray alloc] initWithObjects:@3.0f,@12.0f,@9.0f,@2.0,@4,@1.0f,@0, nil];
    _curIndex = 5;
    self.view2.delegate = self;
    self.view2.deletageSource = self;
    
    NSLog(@"viewDidLoad");
}

#pragma mark Alu_LineShowViewDelegate

- (UIColor*)lineShowLineColor
{
    return [[UIColor alloc] initWithRed:0.10f green:0.40f blue:0.859f alpha:1.0f];
}

- (NSInteger)lineShowLineWidth
{
    return 2;
}

- (UIColor*)lineShowPointColor
{
    return [[UIColor alloc]initWithRed:1.0f green:0.0f blue:0 alpha:0.8];
}

- (UIColor*)lineShowPointDefualtColor
{
    return [[UIColor alloc] initWithRed:0.0f green:1.0f blue:0.0f alpha:0.5];
}

- (CGFloat)lineShowPointRadius
{
    return 5;
}

- (UIFont*)lineShowTitleFont
{
    return [UIFont fontWithName:@"Arial" size:14];
}

#pragma mark Alu_LineShowViewDetegateSource
- (NSInteger)lineShowPointCount
{
    return [_titleArray count];
}

- (NSInteger)lineShowEndPoint
{
    return _curIndex;
}

- (BOOL)lineShowNeedShowPointInIndex:(NSInteger)index
{
    return YES;
}

- (CGFloat)lineShowValueInIndex:(NSInteger)index
{
//    return index%2==0? 10*index : 30*index;
    return [[_valueArray objectAtIndex:index] floatValue];
}

- (NSString*)lineShowTitleInIndex:(NSInteger)index
{
    return [_titleArray objectAtIndex:index];
}

#pragma mark ViewController

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)btnPass
{
//    self.view.lineWidth = 10;
//    _curIndex =  (_curIndex-1)%7;
    _valueArray = [[NSArray alloc] initWithObjects:@3.0f,@12.0f,@0.0f,@10.0,@30,@130,@1000, nil];
    [self.view2 setNeedsDisplay];
}
@end
